package co.yixiang.yshop.module.crm.dal.mysql.crmworkwxconfig;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.crm.dal.dataobject.crmworkwxconfig.CrmWorkWxConfigDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.crm.controller.admin.crmworkwxconfig.vo.*;

/**
 * 企业微信配置 Mapper
 *
 * @author yshop
 */
@Mapper
public interface CrmWorkWxConfigMapper extends BaseMapperX<CrmWorkWxConfigDO> {

    default PageResult<CrmWorkWxConfigDO> selectPage(CrmWorkWxConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmWorkWxConfigDO>()
                .likeIfPresent(CrmWorkWxConfigDO::getCorpName, reqVO.getCorpName())
                .eqIfPresent(CrmWorkWxConfigDO::getCorpId, reqVO.getCorpId())
                .eqIfPresent(CrmWorkWxConfigDO::getContactsSecret, reqVO.getContactsSecret())
                .eqIfPresent(CrmWorkWxConfigDO::getCustomersecret, reqVO.getCustomersecret())
                .eqIfPresent(CrmWorkWxConfigDO::getCustomerReturnUrl, reqVO.getCustomerReturnUrl())
                .eqIfPresent(CrmWorkWxConfigDO::getCustomerReturnToken, reqVO.getCustomerReturnToken())
                .eqIfPresent(CrmWorkWxConfigDO::getCustomerEncodingAsekey, reqVO.getCustomerEncodingAsekey())
                .eqIfPresent(CrmWorkWxConfigDO::getAgentId, reqVO.getAgentId())
                .eqIfPresent(CrmWorkWxConfigDO::getSecret, reqVO.getSecret())
                .eqIfPresent(CrmWorkWxConfigDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(CrmWorkWxConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmWorkWxConfigDO::getId));
    }

}